<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('projects', function (Blueprint $table) {
            $table->id();
            $table->string('title')->index();
            $table->unsignedBigInteger('push_id')->default(0)->comment('发布人');
            $table->string('contract_number')->nullable()->comment('合同编号');
            $table->string('contract')->nullable()->comment('合同(文件地址)');
            $table->string('brief')->nullable()->comment('介绍');
            $table->decimal('price',10,2)->nullable()->comment('金额');
            $table->decimal('budget',10,2)->nullable()->comment('预算');
            $table->date('start_date')->index()->comment('项目开始时间');
            $table->date('end_date')->index()->comment('项目结束时间');
            $table->date('start_actual_date')->nullable()->comment('实际开始时间');
            $table->date('end_actual_date')->nullable()->comment('实际结束时间');
            $table->string('address')->comment('项目地址');
            $table->string('status')->index()->comment('success：完成；afoot：进行中；fail失败；wait：待开始 ');
            $table->string('construct_unit')->nullable()->comment('建设单位');
            $table->string('build_unit')->nullable()->comment('施工单位');
            $table->string('supervise_unit')->nullable()->comment('监理单位');
            $table->string('design_unit')->nullable()->comment('设计单位');
            $table->unsignedBigInteger('company_id')->index();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('projects');
    }
};
